/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ivanhoe
 */
@Entity
@Table(name = "vias_flete")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ViasFlete.findAll", query = "SELECT v FROM ViasFlete v"),
    @NamedQuery(name = "ViasFlete.findByIdViaFlete", query = "SELECT v FROM ViasFlete v WHERE v.idViaFlete = :idViaFlete"),
    @NamedQuery(name = "ViasFlete.findByNombreViaFlete", query = "SELECT v FROM ViasFlete v WHERE v.nombreViaFlete = :nombreViaFlete"),
    @NamedQuery(name = "ViasFlete.findByEnUso", query = "SELECT v FROM ViasFlete v WHERE v.enUso = :enUso")})
public class ViasFlete implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_via_flete")
    private Integer idViaFlete;
    @Size(max = 45)
    @Column(name = "nombre_via_flete")
    private String nombreViaFlete;
    @Column(name = "en_uso")
    private Boolean enUso;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "viasFleteIdViaFlete")
    private Collection<Fletes> fletesCollection;

    public ViasFlete() {
    }

    public ViasFlete(Integer idViaFlete) {
        this.idViaFlete = idViaFlete;
    }

    public Integer getIdViaFlete() {
        return idViaFlete;
    }

    public void setIdViaFlete(Integer idViaFlete) {
        this.idViaFlete = idViaFlete;
    }

    public String getNombreViaFlete() {
        return nombreViaFlete;
    }

    public void setNombreViaFlete(String nombreViaFlete) {
        this.nombreViaFlete = nombreViaFlete;
    }

    public Boolean getEnUso() {
        return enUso;
    }

    public void setEnUso(Boolean enUso) {
        this.enUso = enUso;
    }

    @XmlTransient
    public Collection<Fletes> getFletesCollection() {
        return fletesCollection;
    }

    public void setFletesCollection(Collection<Fletes> fletesCollection) {
        this.fletesCollection = fletesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idViaFlete != null ? idViaFlete.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ViasFlete)) {
            return false;
        }
        ViasFlete other = (ViasFlete) object;
        if ((this.idViaFlete == null && other.idViaFlete != null) || (this.idViaFlete != null && !this.idViaFlete.equals(other.idViaFlete))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.ViasFlete[ idViaFlete=" + idViaFlete + " ]";
    }
    
}
